package moxl.relaxng.grammarmerge;

import moxl.dom.ethereal.EtherealElement;
import moxl.dom.mutable.MutableElement;
import moxl.relaxng.schema.RelaxNgSchemaElementType;

public class GrammarMerger
{
	public MutableElement merge(MutableElement el)
	{
		if (el.getName().equals(RelaxNgSchemaElementType.grammar.getName()))
		{
			return el;
		}
		MutableElement topLevelGrammarEl = new EtherealElement(RelaxNgSchemaElementType.grammar.getName());
		MutableElement startEl = new EtherealElement(RelaxNgSchemaElementType.start.getName());
		startEl.addChild(el);
		topLevelGrammarEl.addChild(startEl);
		return topLevelGrammarEl;
	}

}
